import axios from "axios"

export default class MaterialGPlansModel{
  static materialGPlansModel = null;

  static getInstance(){
    if(this.materialGPlansModel==null){
      this.materialGPlansModel=new MaterialGPlansModel();
    }
    return this.materialGPlansModel;
  }

  saveGPlans(plan,details){//添加材料总计划
    return axios.post("http://localhost/MaterialUsePlan",{"plan":plan,"details":details});
  }

  getGPlansList(args){
    return axios.get("http://localhost/MaterialUsePlan",{params:{args}});
  }

  deletePlan(id){
    return axios.delete(`http://localhost/MaterialUsePlan/${id}`)
  }

  getPlanById(id){
    return axios.get(`http://localhost/MaterialUsePlan/${id}`)
  }

  getDetailsByUseid(useid){
    return axios.get(`http://localhost/MaterialUseDetail/${useid}`)
  }
  updatePlan(plan){
    return axios.put(`http://localhost/MaterialUsePlan`,plan)
  }
}